import { IndexInterceptor } from '@libs/common/interceptors';
import { Body, Controller, Post, UseInterceptors } from '@nestjs/common';

import { DepartmentService } from './department.service';
import { DepartmentIndexDto, DepartmentShowDto } from './dto/department.dto';

@Controller('ding/department')
export class DepartmentController {
  constructor(private readonly departmentService: DepartmentService) {}

  @Post('tree')
  tree(@Body() dto: DepartmentIndexDto) {
    return this.departmentService.tree(dto);
  }

  @Post('index')
  @UseInterceptors(new IndexInterceptor())
  index(@Body() dto: DepartmentIndexDto) {
    return this.departmentService.index(dto);
  }

  @Post('show')
  show(@Body() dto: DepartmentShowDto) {
    return this.departmentService.show(dto);
  }

  @Post('find')
  find(@Body() dto: DepartmentShowDto) {
    return this.departmentService.find(dto);
  }
}
